<?php session_start(); 
if ( $_SESSION["level"] == null ) header("location:login.php");
else if ( $_SESSION["level"] != "admin" ) header("location:index.php");
?>
<!DOCTYPE html>
<html>
 <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <link rel="shortcut icon" href="./files/img/favicon.ico">
  <title>RemindMe</title>

  <link type="text/css" href="./files/jquery-ui/css/smoothness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />	
  <script type="text/javascript" src="./files/jquery-1.6.4.js"></script>
  <script type="text/javascript" src="./files/jquery-ui/js/jquery-ui-1.8.16.custom.min.js"></script>

  <style type="text/css">
    @import "style2.css";
  </style>

  <script type="text/javascript" src="./scripts.js"></script>
</head>
 <?php 
   include 'sql.php';
 ?>

<body>

<div id="access">
  <?php showRightPanel(); ?>
</div> <!--End of access-->

  <!--
  Start Header Area
  -->
<div id="header">
</div><!-- End of HEADER -->

<div id="ribbon">
  <table>
    <tr>

    </tr>
  </table>
</div><!--End of ribbon-->

 <!--
  Start Left Panel Area
  -->
 <?php showLeftPanel($_SESSION['level'], $_SESSION['user']); ?>
    <!--
    End of Left_panel
    -->

 <!--
  Start Container Area
  -->
 <div id="container">
  <div id="content"><!-- Content Area-->
    <div id="createuser">
      <form id="users" action="sql.php" method="post">
	<label>Username: </label><br>
	<input type="text" name="username"></input><br>
	<label>Password: </label><br>
	<input type="password" name="password" id="password"/><br>
	<label>Confirm password: </label><img id="img"/><br>
	<input type="password" name="password_confirm" id="password_confirm"/><br>
	<label>Email: </label><br>
	<input type="text" name="email"/><br>
  <label>Phone Number: </label><br>
  <input type="text" name="phone_number"><br>
	<label>Level: </label><br>
<!--	<input type="text" name="level"></input><br>-->
	<select name="level">
	  <option value="admin">Admin</option>
	  <option value="user">User</option>
	</select><br>
	<input type="submit" name="submit_new_user" value="Create!"/>
      </form>
    </div>
  </div><!--END of content-->
</div><!--END of container-->

<?php showFooter(); ?><!--END of footer-->

<script>
$(document).ready(function(){
  $("#password_confirm").focusout(function(){
    var password = $("#password").val();
    var password_confirm = $("#password_confirm").val();
    if (password != "") {
      if (password == password_confirm) {
	$("#img").attr('src', './files/img/tick.jpg');

      }
      else {
	$("#img").attr('src', './files/img/wrong.png');
      }
    }// end of outer if
    else {
      $("#img").attr('src', '');
    }
  });
});//end of ready
</script>
</body>
</html>